thin.define(function(exports) {
	var self = this;

	// 投注配置
	var arrs = [{
			// 大
			A: {
				"play": "lm",
				"local": "v1",
				"content": "big",
				'name': '大',
				'playId': 8014101,
				'id': '01'
			},
			// 小
			B: {
				"play": "lm",
				"local": "v1",
				"content": "small",
				'name': '小',
				'playId': 8014102,
				'id': '02'
			}
		},
		{
			// 单
			A: {
				"play": "lm",
				"local": "v1",
				"content": "single",
				'name': '单',
				'playId': 8014103,
				'id': '03'
			},
			// 双
			B: {
				"play": "lm",
				"local": "v1",
				"content": "double",
				'name': '双',
				'playId': 8014104,
				'id': '04'
			}
		},
		{
			// 龙
			A: {
				"play": "lm",
				"local": "v1",
				"content": "dragon",
				'name': '龙',
				'playId': 8014105,
				'id': '05'
			},
			// 虎
			B: {
				"play": "lm",
				"local": "v1",
				"content": "tiger",
				'name': '虎',
				'playId': 8014106,
				'id': '06'
			}
		}
	];

	// 计算投注信息
	function main() {
		// 期号
		var issue = thin.store_opts.issue.toString();
		// 彩种
		var gameId = thin.store_bets.gameId;
		// 步长
		var stepIndex = thin.store_opts.stepIndex;
		// 模型
		var mode = thin.store_opts.mode;
		// 金额
		var money = thin.store_opts.step[stepIndex];
		// 投注胆位
		var playCateId = thin.store_opts.playCateId;

		/* // 根据期号尾数获取投注配置
		var idx = issue.substring(issue.length - 1);
		idx = Number(idx) % arrs.length;

		// 注单
		var betBean = arrs[idx][mode]; */
		var opts = {
			gameId: gameId,
			/* totalNums: 1,
			totalMoney: money, */
			betSrc: 0,
			turnNum: issue
			/* 'betBean[0].playId': betBean.playId,
			'betBean[0].money': money */
		};
		
		// 注单编号
		thin.store_opts.playId_arr = [];

		var m = 0;
		var n = 0;
		for (var i in playCateId) {
			// 根据期号尾数获取投注配置
			var iue = (Number(issue) + (n * (n + 1))) + '';
			var idx = iue.substring(iue.length - 1);
			idx = Number(idx) % arrs.length;
			// 注单
			var betBean = arrs[idx][mode];
			
			var playId = gameId + '' + playCateId[i] + '' + betBean.id;
			thin.store_opts.playId_arr.push(Number(playId));
			opts['betBean[' + i + '].playId'] = playId;
			opts['betBean[' + i + '].money'] = money;
			++n;
			m += Number(money);
		}
		opts['totalNums'] = n;
		opts['totalMoney'] = m;

		return opts;
	}

	exports('getBills', main);
});
